package com.wuchao.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @Author wuchao66
 * @Date 2023/9/28 11:53
 * @PackageName:com.wuchao.entity
 * @ClassName: Entry
 * @Description: TODO
 * @Param
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Entry {//toString()

    private int id;
//    @Size(min = 1,max=5,message = "范围不一致")
  @Max(value = 5,message = "分类最大id=5")
    private int categoryId;
   // @NotNull(message = "不能为空")
    @Size(min = 1,max = 2,message = "长度不对")
    private String title;
    private String summary;
    private String uploaduser;
    @JSONField(format = "yyyy-MM-dd")//最简单的
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createdate;
    private int deleted;
    private int version;
    //注入小表充当属性
    private Category category;
    //redis mongdo  amqp

}
